// display all primes numbers up to a given value N as a high limiter
#include <iostream>
#include <cstring>
#include <cassert>

using namespace std;

void primes_in_range(const int N) {
  bool store[N + 1];
  memset(store, true, sizeof(store));

  for (int i = 2; i * i <= N; ++i) {
    if (store[i]) {
      for (int j = i * 2; j <= N; j += i) {
        store[j] = false;
      }
    }
  }

  for (int i = 2; i <= N; ++i) {
    if (store[i]) {
      cout << i << " ";
    }
  }

  cout << endl;
}

int main()
{
  int limit;
  cin >> limit;
  assert(("Limit should be at least 2.", limit >= 2));

  primes_in_range(limit);

  

  return 0;
}